package com.czk.model.ptotorype.practice.shallowcopy;

/**
 *
 * @Author:ChenZhangKun
 * @Date: 2020/8/19 23:32
 */
public class Person implements Cloneable{
    /**
     * 引用对象
     */
    private Clothes clothes;
    /**
     * 基本数据类型
     */
    private String name;
    /**
     * 基本数据类型
     */
    private  int age;

    public Clothes getClothes() {
        return clothes;
    }

    public void setClothes(Clothes clothes) {
        this.clothes = clothes;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "clothes=" + clothes +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    /**
     * 浅拷贝的实现
     * 引用变量运用同一块内存地址
     * @return
     * @throws CloneNotSupportedException
     */
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
